#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Benchmark filters.
Inserts generation time into <span id="benchmark />
"""

import xml.dom.minidom
import time

def execute_minidom(server, document, parameters):
	for n in document.getElementsByTagName('span'):
		if n.hasAttribute('id') and n.getAttribute('id') == 'benchmark':
			n.appendChild(document.createTextNode('%s seconds'
						% str(time.clock() - server.start_time)))
